/**
 * Created by Administrator on 2016/5/25 0025.
 */

var descript = document.getElementById("descript");
var mengceng = document.getElementById("mengceng");
var image = document.getElementById("image");
var pre = document.getElementById("pre").innerText;
var now = document.getElementById("now");
var  feature1 = document.getElementById(" feature1");
//var  feature2 = document.getElementById(" feature2");
//var  feature3 = document.getElementById(" feature3");
//var  feature4 = document.getElementById(" feature4");
var  feature_product1 =document.getElementById("feature_product1");
var  feature_product2 =document.getElementById("feature_product2");
var  feature_product3 =document.getElementById("feature_product3");
var  feature_product4=document.getElementById("feature_product4");
var intro = document.getElementById("intro");
var intro1 = document.getElementById("intro1");
var intro2 = document.getElementById("intro2");
var intro3 = document.getElementById("intro3");
var intro4 = document.getElementById("intro4");

window.onscroll = function(){
    console.log(window.document.body.scrollTop);
    if(window.document.body.scrollTop > 970){
        feature_product1.style.position = "absolute";
        feature_product1.style.left = "0px";
        feature_product1.style.webkitTransform = "rotate(0deg)";
        feature_product1.style.webkitTransition = "all 1s linear";
        feature_product2.style.position = "absolute";
        feature_product2.style.left = "320px";
        feature_product2.style.webkitTransform = "rotate(0deg)";
        feature_product2.style.webkitTransition = "all 1s linear 1s";
        feature_product4.style.position = "absolute";
        feature_product4.style.left = "950px";
        feature_product4.style.webkitTransform = "rotate(0deg)";
        feature_product4.style.webkitTransition = "all 1s linear 0.5s";
        feature_product3.style.position = "absolute";
        feature_product3.style.left = "630px";
        feature_product3.style.webkitTransform = "rotate(0deg)";
        feature_product3.style.webkitTransition = "all 1s linear 1.5s";
    }else if(window.document.body.scrollTop >160){
        intro.style.webkitAnimation = "yidong 2s linear forwards";
        intro1.style.webkitAnimation = "yidong 2s linear forwards 0.5s";
        intro2.style.webkitAnimation = "yidong 2s linear forwards 1s";
        intro3.style.webkitAnimation = "yidong 2s linear forwards 1.5s";
        intro4.style.webkitAnimation = "yidong 2s linear forwards 2s";
    }
}

 function change() {
    mengceng.style.opacity = "0.5";
    mengceng.style.webkitTransition= "all 0.5s linear";
    descript.style.opacity = "1";
     descript.style.webkitTransition = "all 1s linear 0.5s";
     image.style.webkitTransform = "scale(1.25,1.25)";
     image.style.webkitTransition = "all 1s linear";
}
function changeagin(){
    mengceng.style.opacity = "0";
    descript.style.opacity = "0";
    image.style.webkitTransform = "scale(1,1)";
}
var index = 0;
function typewrite(){
    //设置字体样式

    now.style.paddingTop = "20px";
    now.style.lineHeight = "25px";
    now.style.textIndent = "2em";
    now.innerHTML=pre.substring(0,index++);
}
setInterval(typewrite,50);

